<?php
namespace Admin\Controller;
use Think\Controller;
class IndexController extends Controller {

	public function index(){

     	$this->display();
    }

    //处理登录
    public function login(){

     	$admin = M("admins");
    	$map = array();
    	$map['admin_count'] = $_POST['usercount'];
    	$map['password'] = $_POST['userpassword'];
        $rs=$admin->where($map)->select();
        if($rs==null){
            $this->error("用户名密码错误");
        }else{
        	// session("flag","logok");
            $this->success("登录成功",U('Index/informationlist'));
        }
    }

    //显示后台数据
    public function informationlist(){

     	$this->display();
    }

    //初始化后台页面
    public function welcome(){

        //计算俱乐部数量
        $clubnum = M('clubintr')->count();
        $data['0']['clubnum'] = $clubnum;

        //计算课程数量
        $coursenum = M('clubcourse')->count();
        $data['0']['clubcoursenum'] = $coursenum;

        //计算样例视频数量
        $examplevideonum = M('examplevideo')->count();
        $data['0']['examplevideonum'] = $examplevideonum;

        //计算用户数量
        $usernum = M('users')->count();
        $data['0']['usernum'] = $usernum;

        $this->assign('data',$data);//用于初始化表单
        
     	$this->display();
    }
}